package lab03.test11;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * Created by V555 on 2017/12/19.
 */
public class Test {
    public static void main(String[] args) {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        Connection connection=null;
        Statement statement=null;
        try {
            connection= DriverManager.getConnection(
                    "jdbc:mysql://localhost:3306/java_2017?serverTimezone=UTC",
                    "root",
                    "193749");
            statement=connection.createStatement();
            statement.executeUpdate("INSERT INTO t_users(id,usename,password,register_datetime)VALUES (1,'admin','admin',192312312123)" );
            statement.executeUpdate("INSERT INTO t_users(id,usename,password,register_datetime)VALUES (2,'chen','12346',123123213123)");
        } catch (SQLException e) {
            e.printStackTrace();
        }
        finally {
            try {
                connection.close();
                statement.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
}
